import java.util.Objects;
import java.util.stream.Stream;

public enum Season {
    SPRING(1, "春天"),
    SUMMER(2, "夏天"),
    AUTUMN(3, "秋天"),
    WINTER(4, "冬天");

    private Integer key;
    private String value;

    public static String getValue(int key) {
        return Stream.of(Season.values())
                .filter(v -> v.getKey() == key)
                .findFirst()
//                .map(v -> v.value)
                .map(Season::getValue)
                .orElse("未找到此key对应的季节");
    }

    public static Integer getKey(String value) {
        return Stream.of(Season.values())
                .filter(v -> Objects.equals(v.getValue(), value))
                .findFirst()
                .map(Season::getKey)
                .orElse(-1);
    }


    Season(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
